package com.tfjybj.itoo.teach.provider.facade;

import org.apache.dubbo.config.annotation.Service;
import com.github.pagehelper.PageInfo;
import com.tfjybj.itoo.teach.FacadeApi.CourseScheduleApi;
import com.tfjybj.itoo.teach.entity.CourseScheduleEntity;
import com.tfjybj.itoo.teach.provider.service.CourseScheduleService;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by QZS on 2019/5/30.
 */
@Service
@org.springframework.stereotype.Service
public class CourseScheduleFacade implements CourseScheduleApi {
    @Resource
    private CourseScheduleService courseScheduleService;

    /**
     * 添加
     *
     * @param courseScheduleEntity CourseScheduleEntity
     * @return 添加的结果
     * @author 智雪艳
     * @since 2.0.0 2019-05-30 10:35:56
     */
    @Override
    public boolean create(CourseScheduleEntity courseScheduleEntity) {
        return courseScheduleService.save(courseScheduleEntity);
    }

    /**
     * 删除
     *
     * @param id 主键id
     * @return ItooResult 是否删除成功
     * @author 智雪艳
     * @since 2.0.0 2019-05-30 10:35:56
     */
    @Override
    public boolean delete(String id) {
        return courseScheduleService.removeById(id);
    }

    /**
     * 批量删除
     *
     * @param ids ids
     * @return ItooResult 批量删除是否成功结果
     * @author 智雪艳
     * @since 2.0.0 2019-05-30 10:35:56
     */
    @Override
    public boolean deleteByIds(List<String> ids) {
        return courseScheduleService.removeByIds(ids);
    }

    /**
     * 修改
     *
     * @param courseScheduleEntity CourseScheduleEntity
     * @return 修改后的结果
     * @author 智雪艳
     * @since 2.0.0 2019-05-30 10:35:56
     */
    @Override
    public boolean modify(CourseScheduleEntity courseScheduleEntity) {
        return courseScheduleService.updateById(courseScheduleEntity);
    }

    /**
     * 根据id查找CourseSchedule
     *
     * @param id 主键id
     * @author 智雪艳
     * @since 2.0.0 2019-05-30 10:35:56
     */
    @Override
    public CourseScheduleEntity findById(String id) {
        return courseScheduleService.getById(id);
    }

    /**
     * 分页查询所有CourseSchedule
     *
     * @param pageNo   页码
     * @param pageSize 每页条数
     * @author 智雪艳
     * @since 2.0.0 2019-05-30 10:35:56
     */
    @Override
    public PageInfo<CourseScheduleEntity> queryPageAll(Integer pageNo, Integer pageSize) {
        return courseScheduleService.queryPageAll(pageNo,pageSize);
    }

    /**
     * 根据班级_id模糊查询courseSchedule
     *
     * @param classId  班级_id
     * @param pageNo   页码
     * @param pageSize 页数
     * @return 模糊查询的courseSchedule
     * @author 智雪艳
     * @since 2.0.0 2019-05-30 10:35:56
     */
    @Override
    public PageInfo<CourseScheduleEntity> queryCourseScheduleByLikeClassId(String classId, Integer pageNo, Integer pageSize) {
        return courseScheduleService.queryCourseScheduleByLikeClassId(classId,pageNo,pageSize);
    }

    /**
     * 根据id查找CourseSchedule
     *
     * @param courseId 主键courseId
     * @author 智雪艳
     * @since 2.0.0 2019-05-30 10:35:56
     */
    @Override
    public String findByCourseId(String courseId) {
        return courseScheduleService.findByCourseId(courseId);
    }

    /**
     * 无参查询查找CourseSchedule
     *
     * @return courseScheduleEntity
     * @author 智雪艳
     * @since 2.0.0 2019-05-30 10:35:56
     */
    @Override
    public List<CourseScheduleEntity> findCourse() {
        return courseScheduleService.queryCourse();
    }
}
